package cn.edu.neusoft.wuguangsheng.flowerimpression.activity;

import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.Toast;

import cn.edu.neusoft.wuguangsheng.flowerimpression.R;
import cn.edu.neusoft.wuguangsheng.flowerimpression.bean.SuccessBean;
import cn.edu.neusoft.wuguangsheng.flowerimpression.listener.TListener;
import cn.edu.neusoft.wuguangsheng.flowerimpression.model.AddFeedBackModel;

public class UserFanKuiActivity extends BaseActivity {

    ImageView fankui_fh;
    Button fankui_btn;
    EditText fankui_content;
    @Override
    void initView() {
        setLayout_file(R.layout.activity_user_fan_kui);
        fankui_fh = (ImageView)findViewById(R.id.fankui_fh);
        fankui_btn = (Button)findViewById(R.id.fankui_btn);
        fankui_content = (EditText)findViewById(R.id.fankui_content);





    }

    @Override
    void initEvent() {

        fankui_btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                String content = fankui_content.getText().toString().trim();
                if (content.equals("")){
                    Toast.makeText(UserFanKuiActivity.this,"反馈信息不能为空",Toast.LENGTH_SHORT).show();
                }
                else {
                    AddFeedBackModel addFeedBackModel = new AddFeedBackModel();
                    addFeedBackModel.addFeedBack(getid(), content, new TListener<SuccessBean>() {
                        @Override
                        public void onResponse(SuccessBean successBean) {
                            if (successBean.getSuccess().equals("1")){
                                Toast.makeText(UserFanKuiActivity.this,"谢谢你的反馈，管理员会认真查看你们的反馈",Toast.LENGTH_SHORT).show();
                                finish();
                            }
                            else {
                                Toast.makeText(UserFanKuiActivity.this,"反馈失败",Toast.LENGTH_SHORT).show();
                            }
                        }

                        @Override
                        public void onFail(String msg) {
                            Toast.makeText(UserFanKuiActivity.this,"反馈失败",Toast.LENGTH_SHORT).show();
                        }
                    });
                }
            }
        });

        fankui_fh.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });

    }

    @Override
    void initDate() {

    }
}
